package com.sky.controller.admin;


import com.sky.result.Result;
import com.sky.service.WorkspaceService;
import com.sky.vo.BusinessDataVO;
import com.sky.vo.DishOverViewVO;
import com.sky.vo.OrderOverViewVO;
import com.sky.vo.SetmealOverViewVO;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

@Slf4j
@RestController
@RequestMapping("/admin/workspace")
@Api(tags = "工作台相关接口")
public class WorkSpaceController {

    @Autowired
    private WorkspaceService workspaceService;

    //--1、查询今日运营数据 /admin/workspace/businessData
    @GetMapping("/businessData")
    public Result<BusinessDataVO> businessData(){
        BusinessDataVO businessDataVO=workspaceService.businessData(LocalDate.now());
        return Result.success(businessDataVO);
    }

    //--2、查询订单管理数据 /admin/workspace/overviewOrders
    @GetMapping("/overviewOrders")
    public Result<OrderOverViewVO> overviewOrders(){
        OrderOverViewVO orderOverViewVO=workspaceService.overviewOrders(LocalDate.now());
        return Result.success(orderOverViewVO);
    }
    //--3、查询菜品总览 /admin/workspace/overviewDishes
    @GetMapping("/overviewDishes")
    public Result<DishOverViewVO> overviewDishes(){
        DishOverViewVO dishOverViewVO=workspaceService.overviewDishes(LocalDate.now());
        return Result.success(dishOverViewVO);
    }
    //--4、查询套餐总览 /admin/workspace/overviewSetmeals
    @GetMapping("/overviewSetmeals")
    public Result<SetmealOverViewVO> overviewSetmeals(){
        SetmealOverViewVO setmealOverViewVO=workspaceService.overviewSetmeals(LocalDate.now());
        return Result.success(setmealOverViewVO);
    }
}
